<?php
/**
 * 用户列表页
 * @author Wilton Wang <support@hangyutech.com>
 * @author QQ:858794040
 * @link http://iris.hangyutech.com 2016-01-19 14:41:18
 * @copyright  Iris/Yii2/adminLTE
 */
/* @var $this yii\web\View */
$this->title = '用户列表页';
/*
$PAGEJS= <<<EOD
$(function () {
	$("#UserList").DataTable({
		"paging": true,
		"lengthChange": true,
		"searching": true,
		"ordering": true,
		"info": true,
		"autoWidth": true,
		'language': {
			'emptyTable': '没有数据',
			'loadingRecords': '加载中...',
			'processing': '查询中...',
			'search': '检索:',
			'lengthMenu': '每页 _MENU_ 条',
			'zeroRecords': '没有数据',
			'paginate': {
				'first':      '第一页',
				'last':       '最后一页',
				'next':       '',
				'previous':   ''
			},
			'info': '第 _PAGE_ 页 / 总 _PAGES_ 页',
			'infoEmpty': '没有数据',
			'infoFiltered': '(过滤总件数 _MAX_ 条)'
		}
	});
});
EOD;
$this->registerJs($PAGEJS, yii\web\View::POS_END, 'my-options');
*/

?>
<!-- 内容区 -->

<div class="box">
	<!-- /.box-header -->
	<div class="box-body">
		<table id="UserList" class="table table-bordered table-striped">
			<thead>
				<tr>
					<th>ID</th>
					<th>用户名</th>
					<th>Email</th>
					<th>状态</th>
					<th>更新时间</th>
					<th>用户组</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php foreach ($info as $k => $v) {?>
				<tr>
					<td><?=$v->id ?></td>
					<td><?=$v->username ?></td>
					<td><?=$v->email ?></td>
					<td> <?=$v->status ?></td>
					<td> <?= date('Y-m-d',$v->updated_at) ?></td>
					<td> <?=$v->group ?></td>
					<td>
						<div class="btn-group">
							<button type="button" class="btn btn-info" data-toggle="modal" data-target="#ChangeLayer" onclick="ChangePassword(<?=$v->id ?>)">改密码</button>
							<button type="button" class="btn btn-info" data-toggle="modal" data-target="#ChangeLayer" onclick="ChangeGroup(<?=$v->id ?>)">改权限</button>
							<button type="button" class="btn btn-info" data-toggle="modal" data-target="#ChangeLayer" onclick="DelUser(<?=$v->id ?>)">删除</button>
						</div>
					</td>
				</tr>
				<?php }?>
			</tbody>
		</table>
	</div>
	<!-- /.box-body -->
</div>
<!-- 修改密码 -->
<div class="modal fade" id="ChangeLayer">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title"></h4>
                <input type="hidden" value="" id="UserID">
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary">保存</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
	function ChangePassword (id) {
		var html='';
		$('#ChangeLayer  #UserID').val(id);
		$('#ChangeLayer  .modal-title').html('修改密码');
		$('#ChangeLayer .modal-body').html();
	}

	function ChangeGroup (id) {
		var html='';
		$('#ChangeLayer  #UserID').val(id);
		$('#ChangeLayer  .modal-title').html('修改用户组');
		$('#ChangeLayer .modal-body').html();
	}

	function DelUser (id) {
		var html='';
		$('#ChangeLayer  #UserID').val(id);
		$('#ChangeLayer  .modal-title').html('删除用户');
		$('#ChangeLayer .modal-body').html();
	}

</script>
